import java.util.Random;
import java.util.Scanner;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 */
public class Test {
public static void main(String[] args) {
    //猜数字游戏
    /*思路：
    * 1、通过random的相关代码来生成一个范围的随机数
    * 2、通过Scanner来输入你认为的数字
    * 3、判断输入的数字是否与随机生成的数字相同，相同时break跳出循环，否则继续循环猜数字
    * */
    //生成随机数
    Random random = new Random();
    int num = random.nextInt(100);
    System.out.println(num);
    Scanner scanner = new Scanner(System.in);

    while (true){
        //输入在该范围的数字
        System.out.println("请输入1~100中的任意一个数字：");
        int a = scanner.nextInt();
        //判断输入的数字是否与随机生成的数字的大小
        if(a > num){
            System.out.println("猜大了");
        }else if( a < num){
            System.out.println("猜小了");
        }else {
            System.out.println("回答正确");
            break;

        }
    }
    //关闭输入
    scanner.close();
}
    public static void main14(String[] args) {
        System.out.print("hhh");
        System.out.println("哈哈哈");
        System.out.printf("%s\n","嘿嘿嘿");
    }
    public static void main13(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()){
            int a = scanner.nextInt();
            System.out.println(a);
        }
    }
    public static void main12(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入你的年龄");
        int age = scanner.nextInt();
        System.out.println(age);
        System.out.println("输入你的身高");
        float height = scanner.nextFloat();
        System.out.println(height);
        scanner.nextLine();
        System.out.println("输入你所在的城市");
        String city = scanner.nextLine();
        System.out.println(city);
        System.out.println("输入你的姓名");
        String  name = scanner.next();
        System.out.println(name);

    }


    public static void main11(String[] args) {
        int a = 1;
        do {
            System.out.print(a +" ");
            a++;

        }while (a <= 10);
    }
    public static void main10(String[] args) {
        for (int a = 1; a <= 10; a++) {
            System.out.println(a);
        }
    }
    public static void main9(String[] args) {
        int a = 1;
        while (a <= 10){
            System.out.println(a);
            a++;
        }
    }
    public static void main8(String[] args) {
        int i = 1;
        while(i <=7 ){
            if(i == 5){
                continue;
            }
            System.out.println("星期"+ i +"一起聊天");
            i++;

        }
    }
    public static void main7(String[] args) {
        int i = 1;
        while(i <=7 ){
            if(i == 5){
                break;
            }
            System.out.println("星期"+ i +"一起聊天");
            i++;

        }
    }
    public static void main6(String[] args) {
        int day = 2;
        switch (day){
            case 1:
                System.out.println("今天星期一");
            case 2:
                System.out.println("今天星期二");
                break;
            case 3:
                System.out.println("今天是星期三");
                break;
            case 4:
                System.out.println("今天是星期四");
                break;
            case 5:
                System.out.println("今天星期五");
                break;
            case 6:
                System.out.println("今天星期六");
                break;
            case 7:
                System.out.println("今天星期日");
                break;
            default:
                System.out.println("day的值输入错误");
        }
    }
    public static void main5(String[] args) {
        int day = 2;
        switch (day){
            case 1:
                System.out.println("今天是星期一");
                break;
            case 2:
                System.out.println("今天是星期二");
                break;
            case 3:
                System.out.println("今天是星期三");
                break;
            case 4:
                System.out.println("今天是星期四");
                break;
            case 5:
                System.out.println("今天星期五");
                break;
            case 6:
                System.out.println("今天星期六");
                break;
            case 7:
                System.out.println("今天星期日");
                break;
            default:
                System.out.println("day的值输入错误");
        }
        /*long a = 7L;//err
       switch (a){
       }*/
        /*double a = 3.14;//err
        switch (a){
        }*/
        /*float a = 3.14f;//err
        switch (a){
        }*/
        /*boolean flg = true;//err
        switch (flg){

        }*/

    }
    public static void main4(String[] args) {
       /* int a = 3;
        if( a != 3);//err
        {
            System.out.println("哈哈哈");
        }*/
        int a = 3;
        if( a != 3){
            System.out.println("哈哈哈");
        }
    }
    public static void main3(String[] args) {
        int a = 3;
        int b = 5;
        if (a == 5){
            if (b == 5)
                System.out.println("嘿嘿嘿");
            else
                System.out.println("啊啊啊");
        }
        /*错误代码
        int a = 3;
        int b = 5;
        if (a == 5)
            if (b == 5)
                System.out.println("嘿嘿嘿");
        else
                System.out.println("啊啊啊");

       int a = 3;
        int b = 5;
        if (a == 3)
            if (b == 5)
                System.out.println("嘿嘿嘿");
        else
                System.out.println("啊啊啊");*/
           /* int a = 3;
        if( a ){
            System.out.println(a);
        }*/
    }
    public static void main2(String[] args) {
        int a = 3;
        if (a < 5){
            System.out.println("true");
        }else {
            System.out.println("false");
        }
    }
    public static void main1(String[] args) {
        System.out.println("111");
        System.out.println("222");
        System.out.println("333");
    }
}
